<?php

namespace app\admin\controller;

use api\mall\model\StoreItemTagModel;
use cmf\controller\AdminBaseController;

class TagController extends AdminBaseController
{
    public function index(){
        $model = new StoreItemTagModel();
        $item = $model->paginate(20);
        $page = $item->render();
        $this->assign('page',$page);
        $this->assign('items',$item);
        return $this->fetch();
    }

    public function add(){
        $id = $this->request->route('id',0);
        
        if($id>0){
            $model = new StoreItemTagModel();
            $item = $model->where('id',$id)->find();
            if($item){
                $this->assign($item->toArray());
            }
        }else{
            $this->assign('tag_type',0);
        }
        return $this->fetch();
    }
}